home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / network / usrpr103.zip / ADDRIPX.C < prev    next >
C/C++ Source or Header  |  1992-06-18  |  1KB  |  60 lines

  1. To: millsm
  2. From:     Carl W Oakes <COMPCTR/OAKESCW>
  3. Date:     12 May 92 16:00:21 PST
  4. Subject:  Ipx software
  5. X-mailer: Pegasus Mail v2.2 (R4b).
  6.  
  7. // IPX Interrupt Library
  8.  
  9. #include <dos.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12.  
  13. struct {
  14.     unsigned char    network_number[4] ;
  15.     unsigned char    node_address[6] ;
  16. } reply_buffer ;
  17.  
  18. void far    (*ipx_spx)(void) ;                // far pointer to ipx functions
  19. int        get_ipx_spx_pointer (void) ;    // gets ipx address
  20.  
  21. int main ()
  22. {
  23.     int     i ;
  24.  
  25.     if (get_ipx_spx_pointer()) {
  26.         printf ("IPX Driver is not installed!\n") ;
  27.         exit (1) ;
  28.     }
  29.  
  30.     _BX = 0x09 ;
  31.     _ES = FP_SEG (&reply_buffer) ;
  32.     _SI = FP_OFF (&reply_buffer) ;
  33.     ipx_spx () ;
  34.  
  35.     printf ("Network Number: ") ;
  36.     for (i=0; i<4; i++)
  37.         printf ("%02X", reply_buffer.network_number[i]) ;
  38.  
  39.     printf ("\tNode Address: ") ;
  40.     for (i=0; i<6; i++)
  41.         printf ("%02X", reply_buffer.node_address[i]) ;
  42.  
  43.     printf ("\n") ;
  44.     return (0) ;
  45. }
  46.  
  47. int    get_ipx_spx_pointer (void)
  48. {
  49.     union REGS    regs ;
  50.     union SREGS    sregs ;
  51.  
  52.     regs.x.ax = 0x7a00 ;
  53.     int86x (0x2f, ®s, ®s, &sregs) ;
  54.     if (regs.h.al != 0xff)
  55.         return -1 ;
  56.  
  57.     ipx_spx = (void (far *)()) MK_FP (sregs.es, regs.x.di) ;
  58.     return 0 ;
  59. }
  60. -- Carl W. Oakes